using UnityEngine;

namespace Verse;

public struct CachedTexture
{
	private string texPath;

	private Texture2D cachedTexture;

	public Texture2D Texture
	{
		get
		{
			if (cachedTexture == null)
			{
				if (texPath.NullOrEmpty())
				{
					cachedTexture = BaseContent.BadTex;
				}
				else
				{
					cachedTexture = ContentFinder<Texture2D>.Get(texPath) ?? BaseContent.BadTex;
				}
			}
			return cachedTexture;
		}
	}

	public CachedTexture(string texPath)
	{
		this.texPath = texPath;
		cachedTexture = null;
	}
}
